From: Max Semenik Date: Sun, 5 Jun 2011 19:52:03 +0000 (+0000) Subject: Follow-up r89254 and r89481: re-did loading extension updates properly, now upgrading... X-Git-Tag: 1.31.0-rc.0~29693 X-Git-Url: http://git.cyclocoop.org/%22.%24info%5B?a=commitdiff_plain;h=8b12b2590273bcf0d22df23afcdcb4d581c218ba;p=lhc%2Fweb%2Fwiklou.git Follow-up r89254 and r89481: re-did loading extension updates properly, now upgrading extension tables from web interface really works, and without notices --- diff --git a/includes/installer/DatabaseUpdater.php b/includes/installer/DatabaseUpdater.php index f66f81c057..c09a229421 100644 --- a/includes/installer/DatabaseUpdater.php +++ b/includes/installer/DatabaseUpdater.php @@ -73,6 +73,7 @@ abstract class DatabaseUpdater { } $this->maintenance->setDB( $db ); $this->initOldGlobals(); + $this->loadExtensions(); wfRunHooks( 'LoadExtensionSchemaUpdates', array( $this ) ); } @@ -94,6 +95,25 @@ abstract class DatabaseUpdater { $wgExtModifiedFields = array(); // table, index, dir } + /** + * Loads LocalSettings.php, if needed, and initialises everything needed for LoadExtensionSchemaUpdates hook + */ + private function loadExtensions() { + if ( !defined( 'MEDIAWIKI_INSTALL' ) ) { + return; // already loaded + } + $vars = Installer::getExistingLocalSettings(); + if ( !$vars ) { + return; // no LocalSettings found + } + if ( !isset( $vars['wgHooks'] ) && !isset( $vars['wgHooks']['LoadExtensionSchemaUpdates'] ) ) { + return; + } + global $wgHooks, $wgAutoloadClasses; + $wgHooks['LoadExtensionSchemaUpdates'] = $vars['wgHooks']['LoadExtensionSchemaUpdates']; + $wgAutoloadClasses = $wgAutoloadClasses + $vars['wgAutoloadClasses']; + } + /** * @throws MWException * @param DatabaseBase $db diff --git a/includes/installer/Installer.php b/includes/installer/Installer.php index 6df0e082cf..6c6a99f206 100644 --- a/includes/installer/Installer.php +++ b/includes/installer/Installer.php @@ -456,7 +456,7 @@ abstract class Installer { * * @return Array */ - public function getExistingLocalSettings() { + public static function getExistingLocalSettings() { global $IP; wfSuppressWarnings(); diff --git a/includes/installer/WebInstallerPage.php b/includes/installer/WebInstallerPage.php index ac11459788..65fa0a2b60 100644 --- a/includes/installer/WebInstallerPage.php +++ b/includes/installer/WebInstallerPage.php @@ -228,7 +228,7 @@ class WebInstaller_Language extends WebInstallerPage { class WebInstaller_ExistingWiki extends WebInstallerPage { public function execute() { // If there is no LocalSettings.php, continue to the installer welcome page - $vars = $this->parent->getExistingLocalSettings(); + $vars = Installer::getExistingLocalSettings(); if ( !$vars ) { return 'skip'; } diff --git a/maintenance/install.php b/maintenance/install.php index 57e669d178..34e3ea85f3 100644 --- a/maintenance/install.php +++ b/maintenance/install.php @@ -27,6 +27,7 @@ if ( !function_exists( 'version_compare' ) || ( version_compare( phpversion(), ' } define( 'MW_CONFIG_CALLBACK', 'Installer::overrideConfig' ); +define( 'MEDIAWIKI_INSTALL', true ); require_once( dirname( dirname( __FILE__ ) )."/maintenance/Maintenance.php" );